package com.rocbrid.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.rocbrid.pojo.Article;
import com.rocbrid.pojo.User;
import com.rocbrid.service.ArticleService;
import com.rocbrid.mapper.ArticleMapper;
import com.rocbrid.vo.req.ArticlePageVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author gaopeng
* @description 针对表【article】的数据库操作Service实现
* @createDate 2025-04-16 17:14:53
*/
@Service
public class ArticleServiceImpl extends ServiceImpl<ArticleMapper, Article>
    implements ArticleService{

    @Autowired
    ArticleMapper articleMapper;

    @Override
    public IPage<Article> searchAllByCategoryIdArticleIPage (ArticlePageVo articlePageVo){
        Page<Article> articlePage = new Page<>( articlePageVo.getPageNum(),articlePageVo.getPageSize());

        LambdaQueryWrapper<Article> lambdaQueryWrapper = new LambdaQueryWrapper<>();
        lambdaQueryWrapper.eq(Article::getCategoryId,articlePageVo.getCategoryId());

        return articleMapper.selectPage(articlePage,lambdaQueryWrapper);
    }
}




